Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Fix the reopening menu problem in MenuUnstyled demo #33890

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Aug 11, 2022

Added code to prevent reopening a menu after a trigger button is pressed when the menu is already open.
This was caused by the menu closing due to losing focus, then immediately showing up again when the button's onClick handler was fired.

In the future, when we have the MenuButton component, this will be handled internally by the component. For now, such a workaround in user code is needed.

Fixes #33498

@michaldudak michaldudak added docs Improvements or additions to the documentation component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Aug 11, 2022
@michaldudak michaldudak requested a review from a team August 11, 2022 09:34
@mui-bot
Copy link

mui-bot commented Aug 11, 2022

No bundle size changes

Generated by 🚫 dangerJS against 190ab21

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart fix using the onMouseDown as an event invoked before onClick 👌

@michaldudak michaldudak merged commit 7b945c7 into mui:master Aug 12, 2022
@michaldudak michaldudak deleted the iss/33498-close-menu branch August 12, 2022 07:21
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] Unstyled menu can't be closed with the designated Button
3 participants